<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理员管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__ADMIN__css/style.css"  media="all">
  <link rel="stylesheet" href="__ADMIN__layui/css/layui.css"  media="all">
</head>
<body>
<div class="pad-20">
  <fieldset class="layui-elem-field layui-field-title">
  <legend>管理员管理</legend>
  </fieldset>
  <form class="layui-form" action="" method="post" enctype="multipart/form-data">
    <!--基本信息-->
    <div class="layui-form-item">
      <label class="layui-form-label"><i class="layui-error-ts">*</i> 旧密码</label>
      <div class="layui-input-inline" style="width:600px;">
        <input class="layui-input" lay-verify="oldPwd" placeholder="请输入旧密码" value="" type="password" id="oldPwd">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label"><i class="layui-error-ts">*</i> 新密码</label>
      <div class="layui-input-inline" style="width:600px;">
        <input class="layui-input" lay-verify="newPwd"  placeholder="请输入新密码" value="" type="password" id="newPwd">
      </div>
      <div class="layui-form-mid layui-word-aux">6到16个字符，登录密码即为锁屏密码</div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label"><i class="layui-error-ts">*</i> 确认密码</label>
      <div class="layui-input-inline" style="width:600px;">
        <input class="layui-input" lay-verify="confirmPwd"  placeholder="请输入确认密码" value="" type="password" name="data[userpwd]" id="confirmPwd">
      </div>
    </div>
    <!--基本信息-->
    <div class="layui-form-item">
      <div class="layui-input-block">
        <input type="hidden" name="id" value="{$info['id']|default=''}" id="admin_id">
        <button class="layui-btn" lay-submit="" lay-filter="addNews">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
  </form>
</div>
<div class="yzui-filler"></div>
<script src="__ADMIN__js/jquery-1.9.1.min.js" charset="utf-8"></script>
<script type="text/javascript" src="__COMMON__ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__COMMON__ueditor/ueditor.all.js"></script>
<script src="__ADMIN__layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script type="text/javascript">
  layui.use(['form', 'layedit', 'laydate'], function(){
    var form = layui.form
    ,layer = layui.layer
    ,layedit = layui.layedit
    ,laydate = layui.laydate;

    //添加验证规则
    form.verify({
      oldPwd : function(value, item){
        if (value.length == 0) {
          return '请输入旧密码';
        }
        var msg = '';
        $.ajax({
          url: "{:U('Public/getAjaxPassWord')}",
          type: "post",
          async: false,
          data: {
            uadminid:$('#admin_id').val(),
            upass:value
          },
          dataType: "html",
          success: function (data) {
            msg = data;
          }
        });
        if(msg!='1'){return "旧密码输入错误，请重新输入！";}
      },
      newPwd : function(value, item){
        if(value.length < 6){
          return "密码长度不能小于6位";
        }
      },
      confirmPwd : function(value, item){
        if(!new RegExp($("#newPwd").val()).test(value)){
          return "两次输入密码不一致，请重新输入！";
        }
      }
    });

  });
  layui.use('element', function(){
  var $ = layui.jquery
  ,element = layui.element;
  });

</script>
</body>
</html>
